package it.antonio.ilpizze.aop.pointcut;

import it.antonio.ilpizze.aop.Pointcut;
import it.antonio.ilpizze.reflection.MethodAccessor;

public class AndPointcut implements Pointcut {

	private Pointcut[] pointcuts;

	public AndPointcut(Pointcut[] pointcuts) {
		super();
		this.pointcuts = pointcuts;
	}

	@Override
	public boolean apply(MethodAccessor method) {
		for (Pointcut pointcut : pointcuts) {
			if (!pointcut.apply(method)) {
				return false;
			}
		}
		return true;
	}

}
